import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { TaskWorkflowConfigVO, TaskWorkflowConfigForm, TaskWorkflowConfigQuery } from '@/api/config/taskWorkflowConfig/types';

/**
 * 查询任务工作流配置列表
 * @param query
 * @returns {*}
 */

export const listTaskWorkflowConfig = (query?: TaskWorkflowConfigQuery): AxiosPromise<TaskWorkflowConfigVO[]> => {
  return request({
    url: '/config/taskWorkflowConfig/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询任务工作流配置详细
 * @param id
 */
export const getTaskWorkflowConfig = (id: string | number): AxiosPromise<TaskWorkflowConfigVO> => {
  return request({
    url: '/config/taskWorkflowConfig/' + id,
    method: 'get'
  });
};

/**
 * 新增任务工作流配置
 * @param data
 */
export const addTaskWorkflowConfig = (data: TaskWorkflowConfigForm) => {
  return request({
    url: '/config/taskWorkflowConfig',
    method: 'post',
    data: data
  });
};

/**
 * 修改任务工作流配置
 * @param data
 */
export const updateTaskWorkflowConfig = (data: TaskWorkflowConfigForm) => {
  return request({
    url: '/config/taskWorkflowConfig',
    method: 'put',
    data: data
  });
};

/**
 * 删除任务工作流配置
 * @param id
 */
export const delTaskWorkflowConfig = (id: string | number | Array<string | number>) => {
  return request({
    url: '/config/taskWorkflowConfig/' + id,
    method: 'delete'
  });
};
